﻿/**
 * ...
 * @author Innokentiy Shuvalov
 */

package list;
import flash.text.TextFormat;
import gui.hug.HUGLinkButton;
import gui.hug.priv.HUGButtonDisplayState;

class MyLinkButton extends HUGLinkButton {
	
	private var text : String;

	public function new(newText : String = "", ?textFormat : TextFormat, ?bgColor : Int) {
		super(newText, textFormat, bgColor);
		text = newText;
	}
	
	public function refersh() {
		textFormat.underline = false;
		downState = new HUGButtonDisplayState(text, textFormat, bgColor, 0);
		upState = new HUGButtonDisplayState(text, textFormat, bgColor, 0);
		hitTestState = new HUGButtonDisplayState(text, textFormat, bgColor, 0);
		
		textFormat.underline = true;
		overState = new HUGButtonDisplayState(text, textFormat, bgColor, 0);
	}
	
	public function getText() {
		return text;
	}
	
	public function getTextFormat() {
		return textFormat;
	}
	
	public function setTextFormat(format : TextFormat) {
		textFormat = format;
		refersh();
	}
	
	public function setBgColor(color : UInt) {
		bgColor = color;
		refersh();
	}
	
	public function setTextColor(textColor : UInt) {
		textFormat.color = textColor;
		refersh();
	}
	
	public function setNewText( newText : String ) {
		text = newText;
		setText(text);
	}
}